Skip to content

Conversation

abhijitb
Copy link
Contributor

@abhijitb abhijitb commented Aug 7, 2025

Proposed changes

This PR fixes the issue where some/all of the images in the pattern grammar do not get replaced with the local copy of the image.

  1. We were using regex to find images inside the <img> tag, but on checking the pattern grammar I saw that there were URLs like this also

<!-- wp:cover {"url":"https://images.unsplash.com/photo-1621945762389-d8012f045927?q=80&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&w=1200&h=&crop=","dimRatio":80,"isUserOverlayColor":true,"focalPoint":{"x":1,"y":0.24},"minHeight":605,"minHeightUnit":"px","customGradient":"linear-gradient(135deg,rgb(255,255,255) 44%,rgba(255,184,184,0) 100%)","sizeSlug":"full","className":"nfd-p-lg nfd-rounded-xl","layout":{"type":"constrained"}} -->

  1. I also saw that some of the parameters in the image URL's were getting changed to &amp; while storing and reading from the DB, which was then failing the replacing logic that we had in place.

Type of Change

Production

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Dependency update
  • Refactoring / housekeeping (changes to files not directly related to functionality)

Development

  • Tests
  • Dependency update
  • Environment update / refactoring
  • Documentation Update

Visual

Checklist

  • I have read the CONTRIBUTING doc
  • I have viewed my change in a web-browser
  • Linting and tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

1. parsing images from unsplash and patterns.hiive.cloud
2. making sure the images are replaced in content as well
PHP Warning:  Undefined array key "selected_sitegen_homepage" in /wp-content/plugins/bluehost-wordpress-plugin/modules/wp-module-onboarding/includes/RestApi/AppController.php on line 77
@abhijitb abhijitb requested a review from wpalani August 7, 2025 13:23
Copy link
Contributor

github-actions bot commented Aug 7, 2025

@wpalani wpalani merged commit c2e0491 into trunk Sep 1, 2025
12 of 15 checks passed
@wpalani wpalani deleted the fix/ai-sitegen-sideload-images branch September 1, 2025 04:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants